"""
@name : 06.属性包装
@author : wenyao
@projectname: xsfh
"""
#property
#把方法当作属性来使用

class Person():
    def __init__(self):
        self._age = 10

    @property  #会自动产生两个装饰器age.setter 、age.del
    def age(self):
        return self._age

    @age.setter
    def age(self,_age):
        if 0< _age<100:
            self._age = _age
        else:
            raise ValueError("年龄不在范围")
p = Person()
# p.age= 101
print(p.age)
p.age = 98
print(p.age)

# def func1():
#     print("i am func1")
#
# func1()
